import javax.swing.*;
import java.beans.*;

import java.util.*;
public class BuscarPrestatario extends Observable implements Observer {
   

   private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton9;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JComboBox jComboBox4;
    private javax.swing.JComboBox jComboBox5;
    private javax.swing.JComboBox jComboBox6;
    private javax.swing.JFrame jFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private java.awt.Label label1;
	JFrame ventanaBuscarPrestatario;
	
    M_Prestatario prestatario;
    M_Material material;
    
    int tipoPrestatarioSeleccionado[];
    int contador;
    boolean cualquieraSeleccionado;
    
    //M_Material material;
 	ResultadosBusquedaMaterial ventanaResultados;
 	
 	int i;
    int j;
    boolean editando;
 	String seleccionado;
   
   public BuscarPrestatario(){
   	
   	prestatario=new M_Prestatario();
   	material=new M_Material();
   	levantaVista();
   }
   

    private void levantaVista() {
    	ventanaBuscarPrestatario = new JFrame();
       label1 = new java.awt.Label();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jComboBox3 = new javax.swing.JComboBox();
        jLabel14 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jComboBox4 = new javax.swing.JComboBox();
        jButton2 = new javax.swing.JButton();
        jLabel18 = new javax.swing.JLabel();
        jComboBox5 = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jComboBox2 = new javax.swing.JComboBox();
        jButton3 = new javax.swing.JButton();
        jComboBox6 = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jButton9 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton11 = new javax.swing.JButton();
        jButton12 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
		
		llenaComboBox();
		getTiposPrestatarios();		
		
        ventanaBuscarPrestatario.setResizable(false);
        label1.setAlignment(java.awt.Label.CENTER);
        label1.setFont(new java.awt.Font("Arial", 1, 12));
        label1.setText("Ventana Busqueda");

        jTabbedPane1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jTabbedPane1.setMaximumSize(new java.awt.Dimension(0, 0));
        jLabel1.setFont(new java.awt.Font("Arial", 1, 12));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Busqueda de materiales y volumenes");

        jLabel2.setText("Ingrese los criterios de busqueda:");

        jLabel13.setText("Ingrese el tipo de material:");

        jComboBox3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox3ActionPerformed(evt);
            }
        });

        jLabel14.setText("Ingrese palabra:");

        jLabel17.setText("Ingrese tematica:");

        //jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vistasprimerafase/images/preview_16x16.gif")));
        ImageIcon iconobuscar1 = new ImageIcon("images/preview_16x16.gif");
        jButton2.setIcon(iconobuscar1);
        jButton2.setText("Buscar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jLabel18.setText("Ingrese tipo de busqueda:");

        jComboBox5.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Titulo", "Autor" }));

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jLabel2)
                        .addContainerGap(325, Short.MAX_VALUE))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel13)
                            .add(jLabel17))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 150, Short.MAX_VALUE)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel1Layout.createSequentialGroup()
                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jComboBox3, 0, 139, Short.MAX_VALUE)
                                    .add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE)
                                    .add(jComboBox5, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
                            .add(jComboBox4, 0, 148, Short.MAX_VALUE))
                        .add(61, 61, 61))))
            .add(jPanel1Layout.createSequentialGroup()
                .add(199, 199, 199)
                .add(jButton2)
                .addContainerGap(214, Short.MAX_VALUE))
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel18)
                .addContainerGap(361, Short.MAX_VALUE))
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel14)
                .addContainerGap(408, Short.MAX_VALUE))
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(19, 19, 19)
                .add(jLabel1)
                .add(24, 24, 24)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jLabel2)
                        .add(37, 37, 37)
                        .add(jLabel13))
                    .add(jComboBox3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(26, 26, 26)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel17)
                    .add(jComboBox4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(30, 30, 30)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel18)
                    .add(jComboBox5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(31, 31, 31)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel14)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(36, 36, 36)
                .add(jButton2)
                .add(95, 95, 95))
        );
         ImageIcon tab1icon = new ImageIcon("images/preview_16x16.gif");
        
        jTabbedPane1.addTab("Buscar Material",tab1icon, jPanel1);
        

        jLabel4.setFont(new java.awt.Font("Arial", 1, 12));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("Busqueda de Prestatarios");

        jLabel9.setText("Ingrese los criterios de busqueda:");

        jLabel11.setText("Tipo del prestatario:");

        jLabel3.setText("Ingrese palabra:");

        jLabel12.setText("Situacion actual de prestamo:");

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CUALQUIERA", "AL DIA", "PRESTAMO EN CURSO", "MULTADO" }));

        //jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vistasprimerafase/images/ver_prestatario.gif")));
        ImageIcon iconobuscar2 = new ImageIcon("images/ver_prestatario.gif");
        jButton3.setIcon(iconobuscar2);

        jButton3.setText("Buscar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jComboBox6.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Rut", "Apellido" }));
		jComboBox6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox6ActionPerformed(evt);
            }
        });
		
        jLabel5.setText("Ingrese tipo de busqueda:");
        
        jLabel6.setText("Rut Ej: 123456-7");

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel12)
                .addContainerGap(346, Short.MAX_VALUE))
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel5)
                .addContainerGap(361, Short.MAX_VALUE))
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel3)
                .addContainerGap(408, Short.MAX_VALUE))
            .add(jPanel2Layout.createSequentialGroup()
                .add(196, 196, 196)
                .add(jButton3)
                .addContainerGap(217, Short.MAX_VALUE))
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel9)
                .addContainerGap(325, Short.MAX_VALUE))
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 476, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(12, Short.MAX_VALUE))
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel11)
                .add(216, 216, 216)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jComboBox2, 0, 132, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jComboBox6, 0, 132, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jComboBox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 132, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(43, 43, 43))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(342, Short.MAX_VALUE)
                .add(jLabel6)
                .add(53, 53, 53))
        );
           jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel4)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel9)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 26, Short.MAX_VALUE)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel11)
                    .add(jComboBox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 17, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jComboBox2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(29, 29, 29)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel5)
                    .add(jComboBox6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(37, 37, 37)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel3)
                    .add(jTextField3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel6)
                .add(22, 22, 22)
                .add(jButton3)
                .add(131, 131, 131))
        );
        
		ImageIcon tab2icon = new ImageIcon("images/ver_prestatario.gif");
        
        
        jTabbedPane1.addTab("Buscar Prestatario", tab2icon, jPanel2);

        jPanel3.setEnabled(false);
        
        //jButton9.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\iconos\\iconos\\show_offliners.png"));
        ImageIcon icon = new ImageIcon("images/administrator1_16x16.gif");
        jButton9.setIcon(icon);
        jButton9.setText("Prestatario");
        jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton9.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        //jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\iconos\\iconos\\identity.png"));
        ImageIcon icon1 = new ImageIcon("images/report2_16x16.gif");
        jButton1.setIcon(icon1);
        jButton1.setText("Material");
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        //jButton11.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\iconos\\iconos\\search_user.png"));
        ImageIcon icon2 = new ImageIcon("images/zoom_16x16.gif");
        jButton11.setIcon(icon2);
        jButton11.setText("Buscar");
        jButton11.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton11.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton11.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        //jButton12.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\New Folder\\settings1_16x16.gif"));
        ImageIcon icon3 = new ImageIcon("images/settings1_16x16.gif");
        jButton12.setIcon(icon3);
        jButton12.setText("Configuraci\u00f3n");
        jButton12.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton12.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton12.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });

        //jButton5.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\New Folder\\ordered_list_16x16.gif"));
        ImageIcon icon4 = new ImageIcon("images/ordered_list_16x16.gif");
        jButton5.setIcon(icon4);
        jButton5.setText("Multas en curso");
        jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton5.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        //jButton6.setIcon(new javax.swing.ImageIcon("C:\\Users\\Reynaldo Musso\\Desktop\\New Folder\\script_(start)_16x16.gif"));
        ImageIcon icon5 = new ImageIcon("images/script_(start)_16x16.gif");
        jButton6.setIcon(icon5);
        jButton6.setText("Prestamos en curso");
        jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton6.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(jButton9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 85, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 81, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton11, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 107, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 107, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton6)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jButton1)
                        .add(jButton9))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jButton12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(jButton5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(jButton6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton11)))
        );
		ImageIcon volvericon = new ImageIcon("images/left_16x16.gif");
        jButton4.setIcon(volvericon);
        jButton4.setText("Volver");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jFrame1Layout = new org.jdesktop.layout.GroupLayout(ventanaBuscarPrestatario.getContentPane());
        ventanaBuscarPrestatario.getContentPane().setLayout(jFrame1Layout);
        jFrame1Layout.setHorizontalGroup(
            jFrame1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jFrame1Layout.createSequentialGroup()
                .add(jFrame1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jFrame1Layout.createSequentialGroup()
                        .add(282, 282, 282)
                        .add(jButton4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 90, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jFrame1Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .add(jFrame1Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(label1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 631, Short.MAX_VALUE))
                    .add(jFrame1Layout.createSequentialGroup()
                        .add(66, 66, 66)
                        .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 509, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jFrame1Layout.setVerticalGroup(
            jFrame1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jFrame1Layout.createSequentialGroup()
                .addContainerGap()
                .add(label1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 23, Short.MAX_VALUE)
                .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(20, 20, 20)
                .add(jButton4)
                .addContainerGap())
        );
        ventanaBuscarPrestatario.pack();
        ventanaBuscarPrestatario.setVisible(true);
    }
    
    //CODIGO BUSCAR PRESTATARIO------FUNCIONES
    private void jComboBox6ActionPerformed(java.awt.event.ActionEvent evt) {
	
	if(jComboBox6.getSelectedIndex()==1){
	jLabel6.setVisible(false);
	}
	if(jComboBox6.getSelectedIndex()==0){
	jLabel6.setVisible(true);
	}
	
	
	}
	



    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
		this.setChanged();
		this.notifyObservers(); 
		ventanaBuscarPrestatario.dispose();
    }                                        

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
	if(contador==jComboBox1.getSelectedIndex()){
		cualquieraSeleccionado=true;
	}
	
	else{
		cualquieraSeleccionado=false;
	}
	
	if(jComboBox6.getSelectedIndex()==0){
	System.out.println("rut"+jTextField3.getText());
	buscarPrestatario(prestatario.codigosTiposPrestatarios[jComboBox1.getSelectedIndex()],jTextField3.getText(),"","","","","",jComboBox2.getSelectedIndex() );
	
	}
	
	if(jComboBox6.getSelectedIndex()==1){
	System.out.println("apellido"+jTextField3.getText());
	buscarPrestatario(prestatario.codigosTiposPrestatarios[jComboBox1.getSelectedIndex()],"",jTextField3.getText(),"","","","",jComboBox2.getSelectedIndex() );	
		
	}
	
	System.out.println("cualquiera seleccionado="+cualquieraSeleccionado);
	
	//buscarPrestatario(prestatario.codigosTiposPrestatarios[jComboBox1.getSelectedIndex()],jTextField1.getText()+"-"+jTextField10.getText(),jTextField3.getText(),jTextField4.getText(),jTextField5.getText(),jTextField6.getText(),jTextField7.getText(),jComboBox2.getSelectedIndex() );
    
    }                                        
    
  
    public static void main(String args[]) {
   		BuscarPrestatario m=new BuscarPrestatario();
   	//	BuscarMaterial e=new BuscarMaterial();
    }
    
 	
 	private void getTiposPrestatarios(){
 		int i;
 		prestatario.getTiposPrestatarios();
 		contador=0;
 		for(i=0;i<prestatario.numeroTiposPrestatarios;i++){
 		jComboBox1.insertItemAt(prestatario.tiposPrestatarios[i],i);
 		System.out.println(prestatario.tiposPrestatarios[i]);
 		
 		}
 		jComboBox1.insertItemAt("Cualquiera",i);
 		jComboBox1.setSelectedIndex(i);
 		contador=i;
 		
 	}
     
	private void buscarPrestatario(int tipoPrestatario, String rut, String apellidos, String nombres, String direccion, String curso, String telefono, int situacionActual){
		System.out.println(situacionActual+"asdas");
		if(situacionActual==0){
			prestatario.buscarPrestatario(tipoPrestatario,rut, apellidos, nombres, direccion, curso, telefono, cualquieraSeleccionado);
			ResultadosBusquedaPrestatario result=new ResultadosBusquedaPrestatario(prestatario.resultadoBusqueda,prestatario.numeroResultados);
			ventanaBuscarPrestatario.setVisible(false);
			result.addObserver(this);
		}else
		if(situacionActual==1){
			prestatario.buscarPrestatario(tipoPrestatario,rut, apellidos, nombres, direccion, curso, telefono,"AL DIA", cualquieraSeleccionado);
			ResultadosBusquedaPrestatario result=new ResultadosBusquedaPrestatario(prestatario.resultadoBusqueda,prestatario.numeroResultados);
			ventanaBuscarPrestatario.setVisible(false);
			result.addObserver(this);
		}else
		if(situacionActual==2){
			prestatario.buscarPrestatario(tipoPrestatario,rut, apellidos, nombres, direccion, curso, telefono, "PRESTAMO EN CURSO", cualquieraSeleccionado);
			ResultadosBusquedaPrestatario result=new ResultadosBusquedaPrestatario(prestatario.resultadoBusqueda,prestatario.numeroResultados);
			ventanaBuscarPrestatario.setVisible(false);
			result.addObserver(this);
		}else
		if(situacionActual==3){
			prestatario.buscarPrestatario(tipoPrestatario,rut, apellidos, nombres, direccion, curso, telefono, "MULTADO", cualquieraSeleccionado);
			ResultadosBusquedaPrestatario result=new ResultadosBusquedaPrestatario(prestatario.resultadoBusqueda,prestatario.numeroResultados);
			ventanaBuscarPrestatario.setVisible(false);
			result.addObserver(this);
		}
	
	}
	// FIN CODIGO BUSCAR PRESTATARIO
	
	//CODIGO DEL BUSCAR MATERIAL ------ FUNCIONES
	
	private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {
	
	}
    
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
		
		if(jComboBox3.getSelectedIndex()==i-1 && jComboBox4.getSelectedIndex()==j-1){
			System.out.println("ambos cualquiera");
			if(jComboBox5.getSelectedIndex()==0){
				material.buscar("",jTextField2.getText(),"");
			}
			if(jComboBox5.getSelectedIndex()==1){
				material.buscar("","",jTextField2.getText());
			}
			ventanaResultados = new ResultadosBusquedaMaterial(material.resultadoBusqueda, material.numeroResultados);
			material=new M_Material();
			material.reset();
			ventanaResultados.addObserver(this);
			//ventanaBuscarMaterial.setVisible(false);
			ventanaBuscarPrestatario.setVisible(false);//se hizo un cambio para ke deje no visible la ventana de buscar !!!!!!
		}
		
		if(jComboBox3.getSelectedIndex()!=i-1 && jComboBox4.getSelectedIndex()!=j-1){
			System.out.println("ninguno cualquiera");
			if(jComboBox5.getSelectedIndex()==0){
			material.buscar(material.idTiposMateriales[jComboBox3.getSelectedIndex()],"",jTextField2.getText(),"",material.idTematicasMateriales[jComboBox4.getSelectedIndex()]);	
			}
			if(jComboBox5.getSelectedIndex()==1){
			material.buscar(material.idTiposMateriales[jComboBox3.getSelectedIndex()],"","",jTextField2.getText(),material.idTematicasMateriales[jComboBox4.getSelectedIndex()]);	
			}
			ventanaResultados = new ResultadosBusquedaMaterial(material.resultadoBusqueda, material.numeroResultados);
			material=new M_Material();
			material.reset();
			ventanaResultados.addObserver(this);
			//ventanaBuscarMaterial.setVisible(false);
			ventanaBuscarPrestatario.setVisible(false);//se hizo un cambio para ke deje no visible la ventana de buscar !!!!!!
		}
		
		if(jComboBox3.getSelectedIndex()!=i-1 && jComboBox4.getSelectedIndex()==j-1){
			System.out.println("segundo cualquiera");
			if(jComboBox5.getSelectedIndex()==0){
			material.buscar(material.idTiposMateriales[jComboBox3.getSelectedIndex()],"",jTextField2.getText(),"");	
			}
			if(jComboBox5.getSelectedIndex()==1){
			material.buscar(material.idTiposMateriales[jComboBox3.getSelectedIndex()],"","",jTextField2.getText());	
			}
			
			ventanaResultados = new ResultadosBusquedaMaterial(material.resultadoBusqueda, material.numeroResultados);
			material=new M_Material();
			material.reset();
			ventanaResultados.addObserver(this);
			//ventanaBuscarMaterial.setVisible(false);
			ventanaBuscarPrestatario.setVisible(false);//se hizo un cambio para ke deje no visible la ventana de buscar !!!!!!
		}
		
		if(jComboBox3.getSelectedIndex()==i-1 && jComboBox4.getSelectedIndex()!=j-1){
			System.out.println("primero cualquiera"+material.idTematicasMateriales[jComboBox2.getSelectedIndex()]);
			if(jComboBox5.getSelectedIndex()==0){
			material.buscar("",jTextField2.getText(),"",material.idTematicasMateriales[jComboBox4.getSelectedIndex()]);
			}
			if(jComboBox5.getSelectedIndex()==1){
			material.buscar("","",jTextField2.getText(),material.idTematicasMateriales[jComboBox4.getSelectedIndex()]);	
			}
			
			ventanaResultados = new ResultadosBusquedaMaterial(material.resultadoBusqueda, material.numeroResultados);
			material=new M_Material();
			material.reset();
			ventanaResultados.addObserver(this);
			//ventanaBuscarMaterial.setVisible(false);
			ventanaBuscarPrestatario.setVisible(false);//se hizo un cambio para ke deje no visible la ventana de buscar !!!!!!
		}
	}

	/*
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
		this.setChanged();
		this.notifyObservers(); 
		ventanaBuscarMaterial.dispose();

    }*/
    
  	/*
    public static void main(String args[]) {
  	BuscarMaterial e=new BuscarMaterial();
    }
    */
    
	public void compruebaTipoSeleccionado(){
	
		if(material.tiposMaterialesInfo[jComboBox3.getSelectedIndex()] ==0){
			//jTextField9.setEnabled(false);
			jComboBox4.setEnabled(false);
			seleccionado = "libro";
		}
		if(material.tiposMaterialesInfo[jComboBox3.getSelectedIndex()] ==1){
			//jTextField9.setEnabled(true);
			jComboBox4.setEnabled(true);
			seleccionado="otro";
		}
	}	  

   	private void llenaComboBox(){
		try{
			
			material.getTiposMateriales();
			material.getCategorias();
		
			for(i=0;i<material.numeroTiposMateriales;i++){
		    	jComboBox3.insertItemAt(material.tiposMateriales[i],i);
		    	System.out.println(material.tiposMateriales[i]);
		    	
		    }
		    jComboBox3.insertItemAt("Cualquiera",i++);
		    
		    for(j=0;j<material.numeroTematicasMateriales;j++){
		    	jComboBox4.insertItemAt(material.tematicasMateriales[j],j);
		    	System.out.println(material.tematicasMateriales[j]);
		    }
		    jComboBox4.insertItemAt("Cualquiera",j++);
	    }catch(Exception e){}
	    
	    jComboBox3.setSelectedIndex(i-1);
		jComboBox4.setSelectedIndex(j-1);
	}
	 
	
	//FIN CODIGO BUSCAR MATERIAL
	
	//BOTONES DEL MENU KE NO SE UTILIZAN POR AHORA
	
	 private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed
    
     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

	 private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

 	 private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

	  private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed
    
     private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed


	 
   public void update( Observable obse,Object obje ) {
    
    	ventanaBuscarPrestatario.setVisible(true);
   
    }

}